package cn.exrick.xboot.modules.httpMAS.call;

import cn.exrick.xboot.common.jiuqiCommon.callAPIUtil.CallSMSservice;
import cn.exrick.xboot.modules.callApi.entity.SMS;
import cn.exrick.xboot.modules.httpMAS.server.SMSUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
@Slf4j
@RestController
@Api(description = "发送短信测试")
@RequestMapping("/xboot/callSMStest")
@Transactional
public class CallTest {
    /*@Autowired
    private SMSUtils smsUtils;*/
    @Autowired
    private CallSMSservice callSMSservice;

    @RequestMapping(value = "/calltest", method = RequestMethod.POST)
    @ApiOperation(value = "发送短信")
    public  void calltest(){

        try {
            //smsUtils.sendMsg("15145299919","123456789");
            SMS s=new SMS();
            s.setDESTADDR("15145299919");
            s.setMESSAGECONTENT("登录验证码:"+123456);
            boolean b = callSMSservice.sendSMS(s);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }



    public static void main(String[] args) {
        int back = 0;
        try {
            //back = SMSUtils.sendMsg("15145299919", "123456");
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println(back);
    }
}
